package com.threeti.mecool.legacy.application;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.threeti.mecool.legacy.domain.model.basicdata.ProductLegacy;
import com.threeti.mecool.legacy.infrastructure.persistence.ProductLegacyRepository;

@Service
public class ProductLegacyService {
  @Autowired
  private ProductLegacyRepository prodLegRepo;
  
  /** return ProductLegacy with BrandCategoryCode */
  public List<ProductLegacy> findByBrandCategoryCodeAndBrandCode(String brandCategoryCode, String brandCode) {
    List<ProductLegacy> prodLegs = prodLegRepo.findByBrandCategoryCodeAndBrandCode(brandCategoryCode, brandCode);
    for (ProductLegacy prodLeg : prodLegs) {
      prodLeg.setBrandCategoryCode(brandCategoryCode);
    }
    return prodLegs;
  }
}
